<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('setting',$postdata);
		exi('设置成功');
	}
	$footernav =array(
		array('title'=>'分红中心','icon'=>'icon-shouye','action'=>'jy_cong9fan/index/'),
		array('title'=>'收益统计','icon'=>'icon-yiban','action'=>'jy_cong9fan/commission/'),
		array('title'=>'收益明细','icon'=>'icon-dixiaofei','action'=>'jy_cong9fan/orderfee/'),
		array('title'=>'充值订单','icon'=>'icon-dingdan','action'=>'jy_cong9fan/order/'),
		array('title'=>'我的下线','icon'=>'icon-paihao0','action'=>'jy_cong9fan/down/'),
	);	
	$return['item']=$this->plugin_setting('setting');
	$return['item']['yao_feetype']=$return['item']['yao_feetype']?:0;
	$return['item']['footernav']=$return['item']['footernav']?:$footernav;
	$aitip='启用后才生效！';
    if($_SESSION['isfounder']){
        $aitip.='</br>【务必】添加计划任务，否则自动广告值释放，贡献值释放等不正常（管理员可操作）！：
			</br>[注意]：<red>每次执行间隔时间不能低于24小时（设置每天执行一次），建议凌晨0小时10分钟启动。</red>
			</br>1、计划任务：系统--云服务--计划任务;任务URL：jy_cong9fan/plan/
		';
    }
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基础设置',
				'list'=>array(
					array('type'=>'tip','title'=>$aitip),
					array('type'=>'switch','title'=>'开启分红？','name'=>'is_open'),
					array('name'=>'orderfee_rate','title'=>'总业绩分红(业绩%算入分红池)','type'=>'unitstring','unit'=>'%','help'=>'[董事]：拿出市场新增业绩%，平均分配给董事;'),
					array('type'=>'unitstring','unit'=>'%','title'=>'业绩%算入分红池(虚拟展示)','name'=>'orderfee_rate2','help'=>'次日结算，入分红池，按分红资格平均分红给[董事]商！'),
					array('type'=>'unitstring','unit'=>'元','title'=>'营业额虚拟加减','name'=>'orderfee','help'=>'比如填5500那就是现在的营业额再增加5500，如果填 -2500，就是现在的减掉2500！'),
				)
			),
			array(
				'title'=>'充值额度设置',
					'list'=>array(
						array('type'=>'tip','title'=>'【设置举例】：充值额度400，最终返额500，每日返10%；直推加速额：75；'),
						array('type'=>'switch','title'=>'送等量兑换券？','name'=>'is_songbi','help'=>'[兑换券]:就是金币，需要站点设置--支付参数--虚拟币--重命名金币'),
						array('type'=>'unitstring','unit'=>'天','name'=>'fanday','title'=>'N天后开始返','help'=>'默认立即开始返！'),
						array('type'=>'array','name'=>'redfeeset','title'=>'充值额度','add_tip'=>'添加一个充值额度',
									'list'=>array(
										array('type'=>'unitstring','unit'=>'元','name'=>'fee','title'=>'金额'),
										array('type'=>'radio','name'=>'type','title'=>'返还周期','options'=>'fantypes'),
										array('type'=>'unitstring','unit'=>'%','name'=>'onefanfee','title'=>'每次返'),
										array('type'=>'unitstring','unit'=>'元','name'=>'fanfee','title'=>'最终返额'),
										array('type'=>'unitstring','unit'=>'元','name'=>'jiafee','title'=>'直推加速额'),
									),
									'details'=>array(
										array('type'=>'unitstring','unit'=>'元','name'=>'fee','title'=>'金额'),
										array('type'=>'radio','name'=>'type','title'=>'返还周期','options'=>'fantypes'),
										array('type'=>'unitstring','unit'=>'%','name'=>'onefanfee','title'=>'每次返'),
										array('type'=>'unitstring','unit'=>'元','name'=>'fanfee','title'=>'最终返额'),
										array('type'=>'unitstring','unit'=>'元','name'=>'jiafee','title'=>'直推加速额'),
									)
						),
					)
			),
			array(
				'title'=>'上下线关系及分红资格',
				'list'=>array(
					//array('type'=>'radio','title'=>'成为下线条件','name'=>'become_child','options'=>'become_child'),
					array('type'=>'radio','title'=>'成为分红商条件','name'=>'become','options'=>'become','help'=>'如果是无条件，将自动成为分红商！无需填写申请！【<red>注意</red>】:设置了《无条件》成为分红商。然后《首次下单，首次付款》是不会再绑定上下关系的。因为已经是分红商的不能成为别人的下级，除非在成为分红商之前成为别人的下级。'),
					array('type'=>'string','title'=>'消费次数达到（次）','name'=>'num','show'=>array('become'=>2)),
					array('type'=>'string','title'=>'消费金额达到（元）','name'=>'money','show'=>array('become'=>3)),
					array('type'=>'radio','title'=>'分红商是否需要审核','name'=>'become_check','options'=>'is'),
					array('type'=>'radio','title'=>'分红商必须完善资料','name'=>'become_reg','options'=>'is'),
					)
			),
			array(
				'title'=>'分红商等级升级',
				'list'=>array(
						array('type'=>'switch','title'=>'满足其中一个条件就升级','name'=>'is_level_up_one','help'=>'默认，勾选的条件都要满足才行！'),
						array('type'=>'checkbox','title'=>'分红商升级依据','name'=>'level_up_types','options'=>'leveltype','help'=>''),		
					)
			),
			array(
				'title'=>'DIY分享',
				'list'=>array(
					array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
					array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
					array('type'=>'string','title'=>'分享描述','name'=>'share_desc'),
					//array('type'=>'link','from'=>'action','title'=>'分享/二维码跳转链接','name'=>'share_link','help'=>'默认跳转到小店，指定链接后，跳转到指定页面！'),
				)
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
		)
	);
	$return['levels']=$this->getall('level',array('uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');
	$return['levels']['0']=array('id'=>0,'title'=>'默认等级');
	$return['leveltype']=$this->level_up_types;
	$return['otherfee_types']=$this->model('model')->otherfee_types();
	$return['withdraw']=$this->pay_types;
	$return['commissiontype']=$this->commission_types;
	$return['area_type']=array('0'=>'独家代理','1'=>'普通代理');
	$return['is']=array('0'=>'否','1'=>'是');
	$return['become_child']=array('1'=>'首次点击链接','2'=>'首次下单','3'=>'首次付款');
	$return['become']=array('0'=>'无条件','1'=>'申请','2'=>'充值次数','3'=>'充值金额');
	$return['level']=$this->level_types;
	$return['gift_type']=$this->gift_type;
	$return['levelfee_type']=$this->levelfee_type;
	$return['pay_type']=get_pay_types();
	$return['jicha_type']=$this->jicha_type;
	$return['jicha_gettype']=$this->jicha_gettype;
	$return['yao_feetypes']=$this->credit_type;
	$return['yao_feetypes'][0]='佣金';
	$return['fantypes']=array('0'=>'每日返','1'=>'每周返');
	$return['htmls']=$htmls;
	exi($return);
}


